import tkinter as tk
from createnumber import CreateNumber





class UI:

    def __init__(self):
        self.root = tk.Tk()
        self.root.title('随机生成工具')
        self.root.geometry('1380x450+150+200')
        #窗口左上角图标
        self.root.iconbitmap("D:\worker\PythonProject\\randomUtil\\favicon.ico")
        #任务栏图标
        self.root.wm_iconbitmap("D:\worker\PythonProject\\randomUtil\\favicon.ico")
        self.creat_vin()
        self.creat_plate()
        self.creat_battery()
        self.creat_phone()
        self.creat_IDnumber()
        self.creat_credit_code()
        self.creat_battery_nameplate_z()
        self.creat_battery_nameplate_q()
        self.root.mainloop()


    def creat_vin(self):
        btn1 = tk.Button(self.root, text='生成VIN码', command=lambda: (CreateNumber().creat_vin(entry_vin, text_vin)))
        label_vin = tk.Label(self.root, text='新VIN码')
        entry_vin = tk.Entry(self.root, width=18)
        label_vin_old = tk.Label(self.root, text='已存在VIN码')
        text_vin = tk.Text(self.root, width=18, height=20)
        btn1.place(x=50, y=10)
        label_vin.place(x=50, y=55)
        entry_vin.place(x=50, y=75)
        label_vin_old.place(x=50, y=95)
        text_vin.place(x=50, y=115)

    def creat_plate(self):
        btn2 = tk.Button(self.root, text='生成车牌号', command=lambda: (CreateNumber().creat_plate(entry_plate, text_plate)))
        label_plate = tk.Label(self.root, text='新车牌号')
        entry_plate = tk.Entry(self.root, width=10)
        label_plate_old = tk.Label(self.root, text='已存在车牌号')
        text_plate = tk.Text(self.root, width=12, height=20)
        btn2.place(x=200, y=10)
        label_plate.place(x=200, y=55)
        entry_plate.place(x=200, y=75)
        label_plate_old.place(x=200, y=95)
        text_plate.place(x=200, y=115)

    def creat_battery(self):
        btn3 = tk.Button(self.root, text='生成电池编号',
                         command=lambda: (CreateNumber().creat_battery(entry_battery, text_battery)))
        label_battery = tk.Label(self.root, text='新电池编号')
        entry_battery = tk.Entry(self.root, width=15)
        label_battery_old = tk.Label(self.root, text='已存在电池编号')
        text_battery = tk.Text(self.root, width=15, height=20)
        btn3.place(x=320, y=10)
        label_battery.place(x=320, y=55)
        entry_battery.place(x=320, y=75)
        label_battery_old.place(x=320, y=95)
        text_battery.place(x=320, y=115)

    def creat_phone(self):
        btn4 = tk.Button(self.root,text='生成手机号',
                         command=lambda: (CreateNumber().creat_phone(entry_phone,text_phone)))
        label_phone = tk.Label(self.root, text='新手机号')
        entry_phone = tk.Entry(self.root, width=13)
        label_phone_old = tk.Label(self.root, text='已存在手机号')
        text_phone = tk.Text(self.root, width=13, height=20)
        btn4.place(x=460, y=10)
        label_phone.place(x=460, y=55)
        entry_phone.place(x=460, y=75)
        label_phone_old.place(x=460, y=95)
        text_phone.place(x=460, y=115)


    def creat_IDnumber(self):
        btn5 = tk.Button(self.root, text='生成身份证号',
                         command=lambda: (CreateNumber().creat_IDnumber(entry_IDnumber, text_IDnumber)))
        label_IDnumber = tk.Label(self.root, text='新身份证号')
        entry_IDnumber = tk.Entry(self.root, width=20)
        label_IDnumber_old = tk.Label(self.root, text='已存在身份证号')
        text_IDnumber = tk.Text(self.root, width=20, height=20)
        btn5.place(x=600, y=10)
        label_IDnumber.place(x=600, y=55)
        entry_IDnumber.place(x=600, y=75)
        label_IDnumber_old.place(x=600, y=95)
        text_IDnumber.place(x=600, y=115)

    def creat_credit_code(self):
        btn6 = tk.Button(self.root, text='生成信用代码',
                         command=lambda: (CreateNumber().creat_credit_code(entry_credit_code, text_credit_code)))
        label_credit_code = tk.Label(self.root, text='新信用代码')
        entry_credit_code = tk.Entry(self.root, width=20)
        label_credit_code_old = tk.Label(self.root, text='已存在信用代码')
        text_credit_code = tk.Text(self.root, width=20, height=20)
        btn6.place(x=780, y=10)
        label_credit_code.place(x=780, y=55)
        entry_credit_code.place(x=780, y=75)
        label_credit_code_old.place(x=780, y=95)
        text_credit_code.place(x=780, y=115)

    def creat_battery_nameplate_z(self):
        btn7 = tk.Button(self.root,text='生成重卡玖行电池铭牌',
                         command=lambda: (CreateNumber().creat_battery_nameplate_z(entry_battery_nameplate,text_battery_nameplate)))
        label_battery_nameplate = tk.Label(self.root, text='新电池铭牌')
        entry_battery_nameplate = tk.Entry(self.root, width=20)
        label_battery_nameplate_old = tk.Label(self.root, text='已存在电池铭牌')
        text_battery_nameplate = tk.Text(self.root, width=20, height=20)
        btn7.place(x=960, y=10)
        label_battery_nameplate.place(x=960, y=55)
        entry_battery_nameplate.place(x=960, y=75)
        label_battery_nameplate_old.place(x=960, y=95)
        text_battery_nameplate.place(x=960, y=115)

    def creat_battery_nameplate_q(self):
        btn8 = tk.Button(self.root,text='生成轻卡电池铭牌',
                         command=lambda: (CreateNumber().creat_battery_nameplate_q(entry_battery_nameplate,text_battery_nameplate)))
        label_battery_nameplate = tk.Label(self.root, text='新电池铭牌')
        entry_battery_nameplate = tk.Entry(self.root, width=30)
        label_battery_nameplate_old = tk.Label(self.root, text='已存在电池铭牌')
        text_battery_nameplate = tk.Text(self.root, width=30, height=20)
        btn8.place(x=1130, y=10)
        label_battery_nameplate.place(x=1130, y=55)
        entry_battery_nameplate.place(x=1130, y=75)
        label_battery_nameplate_old.place(x=1130, y=95)
        text_battery_nameplate.place(x=1130, y=115)



if __name__ == "__main__":
    UI()

